Winter 2026 Day 4
fork() creates a new child process
init process is ancestor of all processes
pstree in a terminal to seeexec() makes a process execute a given executable (effectively replaces the process)exit() terminates a processwait() causes a parent to block until child terminatesfork()?exec() to change its memory image to a new programfork() then exec())?
exec()Some operating systems do not allow child to exist if its parent has terminated. If a process terminates, then all its children must also be terminated
The parent process may wait for termination of a child process by using the wait() system call. The call returns status information and the pid of the terminated process
wait()), and process completes, process is a zombie
wait(), even if the child exits firstwait(), process is an orphan
init benevolently adopts orphansWhat isn’t clear?
Comments? Thoughts?
View namespaces a process belongs to:
Use unshare to create a new PID namespace:
Compare namespace inodes before and after (same inode = same namespace):
View what cgroup a process belongs to:
Check your current limits:
In practice, cgroups are invisible to users, kernel enforces limits automatically when a process exceeds allocated resources
What isn’t clear?
Comments? Thoughts?
send() and recv()send() and recv() block or not?send() & recv()); passing a message is slower than controlling access to shared memory (messages are copied) “Gemini, make an image in the style of a video game pitting pipes versus shared memory”
What isn’t clear?
Comments? Thoughts?
read()libc.so mapped into all running C programsread()), and the data is copied directly into the user-mode portion of memorymmap a file, but do some trickery beforehand and use special filesname → fd → mmaptmpfs (/dev/shm)shm_open()) IPC may not work in your favor in macOSshmget(): allocateshmat(): attachshmdt(): detachshmctl(): control (destroy with IPC_RMID)$?echo $?What isn’t clear?
Comments? Thoughts?